Skip to content

Diagnose: one list of what is wrong with a game, with fixes you can undo - #93

Merged
I4cTime merged 28 commits into
mainfrom
feat/diagnose
Nov 17, 2026
Merged

I4cTime merged 28 commits into
mainfrom
feat/diagnose

Conversation

@I4cTime

@I4cTime I4cTime commented Nov 17, 2026 •

Copy link
Copy Markdown
Owner

Summary

Diagnose: one button per game that lists what is wrong with it, with fixes you can preview and undo. It replaces the "Launch check" and "Known fixes" buttons. This is the first of three slices of the 1.4 "fix release"; nothing here bumps the version.

What it does

  • Builds one list of findings for a Steam game or Non-Steam shortcut from its launch options, Proton build, install folder, the end of its Proton log, the machine (a working Vulkan driver, a 32-bit Vulkan driver, free disk space) and a bundled pack of rules. Findings are ranked: stops the game from starting, probably the cause, worth trying, for context, checked and fine.
  • Each finding shows the log line or setting it is based on. A rule from the pack links to the source it was derived from.
  • "Fix this" shows the launch options and Proton build before and after, saves a snapshot, then writes. Undo restores the snapshot, also after a restart, and asks before overwriting changes made since. It warns when Steam is running, because Steam rewrites its settings on exit.
  • It reads files and settings only. It never starts the game.

How it is built

  • docs/fix-pack.md is the contract for the rule format, committed before the code. A rule can only set an environment variable from a narrow character set, add one game switch after %command%, remove a wrapper word, reset to Steam's default Proton, or give a manual instruction. It cannot put free text into launch options, which Steam hands to a shell. tests/test_core_safety.py covers the rejections.
  • core/fix_pack.py (loader and validator), core/system_checks.py (three-state checks: one that cannot run says "could not check"), core/snapshots.py (the undo store), core/diagnose.py (facts, findings, ranking), core/fix_apply.py (pure plan, then snapshot, write, verify, roll back).
  • core/data/fix_pack.json: 26 rules (18 read the Proton log, 6 look at launch options, 2 are tweaks for one game). Every log string was confirmed in the upstream commit Proton 11 pins or in Proton's script; tests/test_fix_pack_rules.py has a sample line per log rule and healthy-run lines that no rule may match.
  • controllers/diagnose_controller.py and qml/DiagnoseDialog.qml. The launch check and fixes controllers and known_fixes.json are removed.

Also fixed

  • The Proton version picker offered Valve's builds as proton_9_0, proton_8_0, proton_7_0. Steam's names are proton_9, proton_8, proton_7 (read from appinfo.vdf). Choosing one wrote a build Steam does not know, and the launch check called real Valve builds "gone". The list now has Steam's names, including Proton 10, 11 and Hotfix; a game still carrying an old name gets a finding with a one-click fix.

Removed, and why

  • The 14 built-in known fixes. Checked against the Proton and GE-Proton READMEs and the issue tracker, none was both sourced and still correct. Cyberpunk 2077 and Elden Ring get a sourced tweak in the new pack.
  • The five generic switches the old dialog listed for every game. They were toggles, not fixes for anything Diagnose can detect.

Type

  • Feature
  • Fix
  • Security
  • Docs
  • Chore / CI / deps

Checklist

  • ruff check protonshift passes (also with ruff 0.17.5, which main now allows)
  • pytest passes (1507, on Python 3.11, 3.12 and 3.14)
  • pyside6-qmllint -I protonshift/qml protonshift/qml/**/*.qml passes (0 errors; warnings went from 924 to 896, the new dialog has none)
  • CHANGELOG.md updated under [Unreleased] (for user-facing changes)
  • Docs (README / ARCHITECTURE.md / CLAUDE.md) updated if behavior or layout changed
  • Flatpak manifests updated if dependencies or packaged files changed: no manifest change needed. No new dependency; fix_pack.json ships through the existing core/data/*.json package-data rule. The store description in the metainfo was updated.
  • If touching core/shader_cache.py's _APP_ID_RE or core/scopebuddy.py's _KEY_RE: not touched. Two new boundaries of the same kind are added and tested: the fix pack's action limits (tests/test_core_safety.py) and the snapshot store's app id check (tests/test_snapshots.py). CLAUDE.md lists them.
  • If adding a Theme.qml palette: none added. Diagnose uses existing tokens only.

Verification

Looked at: the dialog run against a fake Steam library (lab/protonshift-ui-checks/fake_home.py) on the default Qt platform: the findings list, the "Fix this" preview, Apply, Undo in a fresh app process, the undo conflict with "Undo anyway", the old build-name case, a clean game, a Non-Steam shortcut (Copy in place of Apply), light mode and a second visual style. On disk, Apply changed LaunchOptions from PROTON_LOG=1 strangle 60 %command% %command% to PROTON_LOG=1 strangle 60 %command% and Undo restored the file byte for byte. The system checks were run read-only on a real machine (NVIDIA, Arch).

Review: an independent code review of this PR found ten defects; all ten are fixed on the branch (commit 91ceb64) with tests. The ones users would have met: the fix for a missing %command% placed it after a wrapper's name instead of its options, a game set to a Steam Linux Runtime tool was called a missing Proton build, native Linux games were diagnosed as Proton games, and Undo replaced unsaved launch-option edits without warning. The review also showed two of the pack's limits were bypassable (a repeated alternation in a log expression, and a forbidden-variable list that missed names such as BASH_ENV); the contract now only allows repeating a single character or class and only setting variables from named families.

Not covered:

  • Native detection for Steam games is a guess (no forced Proton build, no prefix folder, no .exe near the top of the install folder). It errs toward treating a game as a Proton game.
  • A real failing game. The log rules were exercised on sample lines taken from upstream source and public issues, and on one real log from a game that ran (no rule fired).
  • The Flatpak build. Inside the sandbox the Vulkan and 32-bit driver checks are expected to report "could not check" in more cases; that path is unit tested, not run.
  • Heroic and Lutris games (next slice), and updating the rule pack without an app release (the slice after).
  • The "Apply" label with Steam closed, and real Esc and Tab keypresses in the dialog.
  • AMD and Intel GPUs for the vendor detection, beyond unit tests.

Breaking changes

None for stored data: the user's own fixes under ~/.config/protonshift/fixes/ still load. The "Launch check" and "Known fixes" buttons are gone from the game pane; Diagnose covers both.

🤖 Generated with Claude Code

I4cTime and others added 28 commits November 16, 2026 22:37
Diagnose needs fixes that match on a log line and on the machine, not only
on an App ID, and that cannot turn pack data into shell text. This is the
schema the loader and its test will enforce; the code follows.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Upstream source shows several Wine and DXVK error lines are printed by
healthy runs as well. A rule needs a way to require the confirming line.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Diagnose needs two things no module had: facts about the machine that
explain a game not starting (Vulkan, a 32-bit Vulkan driver, free disk),
and a record of every change it makes so Undo can put a game back exactly,
even after a restart.

Each check has three states. One that cannot be carried out says so and
never reports ok on a guess: inside the Flatpak the host's /etc is not
visible, vulkaninfo may be missing, and Flatpak Steam brings its own
drivers. The snapshot store treats the app id as untrusted, since it
becomes a file name, and discards entries with newlines on read as well as
on write, because Undo feeds them to Steam's config.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The loader was built to the stricter reading wherever the format left
room. The contract now says so, and caps open-ended repeats in a log
expression.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The loader for the format in docs/fix-pack.md. It is strict on purpose:
launch options reach a shell, so a rule may only name an environment
variable and a value from a narrow character set, one game switch, or a
wrapper word to remove, and anything it does not recognise rejects the
rule instead of loading with defaults. Log expressions are checked for a
real literal anchor and for shapes that can run away on a long line.

The user's own v1 fixes load as advice rules marked as theirs. The bundled
pack starts empty; test_bundled_pack_is_clean keeps what is added honest
(source URL, verified date, unique ids, no rejected rule).

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The built-in list offered proton_9_0, proton_8_0 and proton_7_0. Steam's
names are proton_9, proton_8 and proton_7 (read from appinfo.vdf), so the
picker wrote a build Steam does not know, and the launch check called a
game on a real Valve build "gone". The list now holds the real names,
including Proton 10, 11 and Hotfix, each with a label in the picker.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
One test replaced os.stat with a one-argument lambda. pytest's own calls
pass follow_symlinks on 3.11 and 3.12, so the run died there; it only
passed on 3.14. The patch now forwards everything to the real function.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
One list of findings for a game, built from the launch check, the Proton
log, the fix pack and the system checks, ranked by how likely each is to
be the reason the game will not start. A finding carries its evidence and,
where a fix is mechanical, the actions that make it.

Applying is planned as a pure before/after first, so the user sees the
exact change. The write happens only if Steam's files still match what
was checked, a snapshot is saved before it, a failed second write puts
the first one back, and Undo refuses to overwrite later edits unless told
to. Launch check findings gained ids and actions; the gathering that sat
in its controller now lives in core, where disk work belongs.

A game still set to an old proton_9_0 name gets a blocking finding with a
one-click fix back to Steam's default.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…ource

18 rules read the Proton log, 6 look at launch options, 2 are tweaks for
one game. Every log string was confirmed in the upstream commit Proton 11
pins (Wine, DXVK, VKD3D-Proton) or in Proton's own script, and every
remedy in the issue or documentation page the rule links to.

Six planned rules were dropped while checking. Most of them matched lines
that Proton prints through its log() helper, which goes to stderr and
never reaches steam-<appid>.log, so they could not have fired. One needed
a GE-Proton point release the format cannot express, and one matched a
line that only appears in the Steam Linux Runtime's own log.

tests/test_fix_pack_rules.py holds a real sample line for every log rule
and a set of lines from healthy runs that no rule may match.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
A rule can now stand down when a line shows that a more exact rule covers
the same failure. DXVK prints "Failed to initialize DXVK" after "No
adapters found", so a missing driver gave two findings; it gives one.

Proton prints its low open-files and low max_map_count warnings on every
run where the value is low, also for games that work. They are advice
now, not "probably the cause".

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…u can undo

The game pane's Launch check and Known fixes buttons become one Diagnose
button. Its dialog lists findings by how likely they are to be the
reason the game will not start, each with its evidence and where the
knowledge comes from. "Fix this" shows the launch options and Proton
build before and after, applies in one click, and the last fix can be
undone, also after a restart.

Diagnose says when Steam is running (it rewrites its settings on exit),
when the launch editor has unsaved edits, and for a Non-Steam shortcut
offers the new line to copy, since the app cannot write shortcuts.

The dialog is its own QML file. The launch check and fixes controllers
and known_fixes.json are gone; the gathering they did lives in core.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…wraps at words

A game still set to proton_9_0 was told the build was "no longer
installed" and to reinstall it. Steam never had that name; an older
ProtonShift wrote it. The finding says so.

The row that states which log was read repeated the path in its sentence
and again as evidence. Evidence lines now wrap at word boundaries when
they can.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…iption

The README's lead feature is now Diagnose; the Launch check and fixes
database sections are gone with the features. The System section no
longer claims live temperatures: GPU data is read at start and on
Refresh. The store description listed four things and left out most of
what the app does.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…r wrong

A repeat may now only repeat a single character or class: the nested
repeat rule let a repeated alternation with overlapping branches through,
and that backtracks exponentially.

A pack may only set variables from named families. A list of forbidden
names missed BASH_ENV, GCONV_PATH and others, and can never be complete.

The user's own fixes were documented as free of the value limits but the
code refused them, which broke values such as WINEDLLOVERRIDES. They are
written single-quoted now, and the doc says what is still refused.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
A one-click fix must not leave the game broken. Adding a missing
%command% put it after a wrapper's name, so its options became game
arguments (strangle 60 -> strangle %command% 60). It now goes after the
options of the wrappers that take them, after -- for gamescope and
ScopeBuddy, and straight after commands that take none.

Diagnose called a game set to a Steam Linux Runtime tool a missing
Proton build, a native Linux game a Proton game, and a missing host
driver a blocker for Flatpak Steam, which brings its own. All three now
say what is true.

Undo and Proton-only fixes replaced unsaved launch-option edits without
a word; the editor text is kept unless the launch options changed, and
Undo warns first. A write that failed twice no longer deletes the record
that Undo needs. A shortcut with a missing Proton build is pointed to
the picker, not told the fix is in place.

The pack's limits were looser than the contract claimed. A repeat may
only repeat one character or class (a repeated alternation backtracked
exponentially), and a rule may only set variables from named families
(the forbidden list missed BASH_ENV and others). The user's own fixes
were refused for values the docs allowed; they are written single-quoted
and only what quoting cannot hold is refused.

The two per-game tweaks stop being offered once applied.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@I4cTime
I4cTime merged commit 84498b0 into main Nov 17, 2026
6 checks passed
@I4cTime
I4cTime deleted the feat/diagnose branch November 17, 2026 06:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant